<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
<title>分配对象</title>
<link rel="stylesheet" href="<?php echo $_BASE_DIR ?>baodan/css/common.css" >
<link rel="stylesheet" href="<?php echo $_BASE_DIR ?>baodan/css/distribution-object.css" >
</head>

<body>
<header class="header">
    <a class="back" href="javascript:history.back(-1)"></a>
	<div class="title">激活用户</div>
</header>
<div style="height:40px;"></div>


<div class="header2 clearfix">
	   <a href="javascript:void(0)"><span class="back2 fl"></span></a>
	   <div class="search-box2 fl clearfix">
			<span class="search-icon fl"></span>
			<input type="text" class="search2 fr"  name="user_search" value="<?php echo $keyword?>" placeholder="输入姓名/手机号码搜索"  />	
		</div>
		<button class="search-btn2 fl" onclick="search();">搜索</button>	
</div>

<ul class="driver-list">
  <?php if(count($user)){
      foreach ($user as $v){
 ?>
	 <li class="clearfix">
	     <label class="demo--label">
			<input class="demo--radio" type="radio" name="uid"  value="<?php echo $v['id']?>"/>
			<span class="demo--radioInput"></span>
			<div class="right">
			<?php 
			if($v['active_code'] ==''){
			    $jihuo = '未激活';
			}else{
			    $jihuo = '已激活';
			}
			?>
					<p class="driver-name">姓名：<?php echo $v['realname']?> <span style="float:right;margin-right:6px;color:#4fd95a"><b><?php echo $jihuo?></b></span></p>
					<p class="plate-num">手机：<?php echo $v['acctname']?></p>
			</div> 
         </label>
	 </li>
	 <?php }
  }?>

</ul>

<div class="confirm" onclick = "distribute();">激活该用户</div>
<script type="text/javascript" src="<?php echo $_BASE_DIR ?>baodan/js/jquery-3.1.1.min.js"></script>
<script>
function search(){
	var keyid = <?php echo $keyid?>;
	var searchkey = $('.search2').val();
	 location.href = '/my/keysused?keyword='+encodeURIComponent(searchkey)+'&keyid='+keyid;
	 return false;
}
function distribute(){
	var ucheck =  $('input[name="uid"]:checked');
	var ulen = ucheck.length;
  
	if(ulen == 0){
         alert('请选中报单的用户');return false;
	}
	
   var uid = $('input[name="uid"]:checked').val();
	var keyid = <?php echo $keyid?>;
	var ajaxurl = "/my/keysused";
	$.post(ajaxurl, {
		uid: uid,
		keyid: keyid,
	}, function(data){
		if(data.status == 0){
			alert(data.msg);
			//location.href='/my/keys?status=1';
			return false;	
		}else{
			alert(data.msg);
			return false;	
		}
	}, 'json');
	
	
}
</script>
</body>
</html>
